package com.itboye.mengwu.data.repository;

import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.google.gson.reflect.TypeToken;
import com.itboye.core.interfaces.ICompleteListener;
import com.itboye.core.utils.BaseErrorListener;
import com.itboye.core.utils.BaseSuccessReqListener;
import com.itboye.core.utils.ByJsonRequest.Builder;
import com.itboye.mengwu.data.interfaces.IMyLunTan;
import com.itboye.mengwu.data.model.LuntanTieZiBean;
import com.itboye.mengwu.data.model.LuntanTieZiBean;
import com.itboye.mengwu.data.model.MyLunTanDateBean;
import com.itboye.mengwu.data.model.MyPingJiaBean;
import com.itboye.mengwu.data.model.MyTieZiCenterBean;
import com.itboye.mengwu.data.model.MyZengSongPingJiaBean;
import com.itboye.mengwu.data.model.ShopPingJiabean;
import com.itboye.mengwu.data.model.StoreDiscountBean;
import com.itboye.mengwu.data.model.TieZiBaoHanReply;
import com.itboye.mengwu.data.model.TieZiModel;

public class MyLunTanRepository extends BaseNetRepository implements
		IMyLunTan<LuntanTieZiBean> {
	public static final String QueryMyTiezi = "BY_BbsUserCenter_queryThread";// 查询我的帖子
	public static final String MyTieZi = "BY_BbsUserCenter_queryPost";// 查询我的回复
	public static final String MyPingLun = "BY_BbsUserCenter_queryComment";// 我的评论
	public static final String MyThemeReply = "BY_BbsUserCenter_replyThread";// 我的帖子的回复
	public static final String MyTieZiPingLun = "BY_BbsUserCenter_replyPost";// 我的回复的评论
	public static final String PersonMessage = "BY_BbsUserCenter_getUserInfo";// 个人信息
	String api = "100";

	
	public  static  final  String MyPingJia="BY_bbsUserCenter_proComment";
	
	public  static  final  String MyZengSongPingJia="BY_BbsUserCenter_giftComment";
//	MyPingJiaBean
	// BY_BbsUserCenter_queryThread
	public MyLunTanRepository(ICompleteListener listener) {
		super(listener);
		// TODO Auto-generated constructor stub
	}

	@Override
	public void add(LuntanTieZiBean model) {
		// TODO Auto-generated method stub

	}

	@Override
	public void delete(LuntanTieZiBean model) {
		// TODO Auto-generated method stub

	}

	@Override
	public void update(LuntanTieZiBean model) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void getInfo(LuntanTieZiBean model) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<TieZiBaoHanReply>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("page_no", model.getPage_no());
		params.put("page_size", model.getPage_size());	
		params.put("uid", model.getUid());
		params.put("fid", model.getFid());
		params.put("img_num", "3");
		params.put("fresh", model.getFresh());
		// 目前最简化调用
		// START
		(new Builder<TieZiBaoHanReply>())
				.setTypeVerParamsAndReturnClass(QueryMyTiezi, apiVer, params,
						type)
				.requestListener(
						new BaseSuccessReqListener<TieZiBaoHanReply>(
								getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public List<LuntanTieZiBean> query(LuntanTieZiBean model) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void MyTheme(String page_no, String page_size, String uid,
			String img_num) {
		// TODO Auto-generated method stub

	}

	@Override
	public void MyTieZi(String page_no, String page_size, String uid,
			String img_num) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<StoreDiscountBean>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("page_no", page_no);
		params.put("page_size", page_size);
		params.put("uid", uid);
		params.put("img_num", img_num);
		// 目前最简化调用
		// START
		(new Builder<StoreDiscountBean>())
				.setTypeVerParamsAndReturnClass(MyTieZi, apiVer, params, type)
				.requestListener(
						new BaseSuccessReqListener<StoreDiscountBean>(
								getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void MyPingLun(String uid) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<MyLunTanDateBean>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("uid", uid);
		// 目前最简化调用
		// START
		(new Builder<MyLunTanDateBean>())
				.setTypeVerParamsAndReturnClass(MyPingLun, apiVer, params, type)
				.requestListener(
						new BaseSuccessReqListener<MyLunTanDateBean>(
								getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void MyThemeReply(String page_no, String page_size, String uid,
			String img_num) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<StoreDiscountBean>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("page_no", page_no);
		params.put("page_size", page_size);
		params.put("uid", uid);
		params.put("img_num", img_num);
		// 目前最简化调用
		// START
		(new Builder<StoreDiscountBean>())
				.setTypeVerParamsAndReturnClass(MyThemeReply, apiVer, params,
						type)
				.requestListener(
						new BaseSuccessReqListener<StoreDiscountBean>(
								getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void MyTieZiPinglun(String page_no, String page_size, String uid) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<StoreDiscountBean>() {
		}.getType();
		String apiVer = api;
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("page_no", page_no);
		params.put("page_size", page_size);
		params.put("uid", uid);
		// 目前最简化调用
		// START
		(new Builder<StoreDiscountBean>())
				.setTypeVerParamsAndReturnClass(MyTieZiPingLun, apiVer, params,
						type)
				.requestListener(
						new BaseSuccessReqListener<StoreDiscountBean>(
								getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void MyPingJia(String uid,String max_img,String page_no,String page_size) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<ShopPingJiabean>() {
		}.getType();
		String apiVer = "101";
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("uid", uid);
		params.put("max_img", max_img);
		params.put("page_no", page_no);
		params.put("page_size", page_size);
		
		// 目前最简化调用
		// START
		(new Builder<ShopPingJiabean>())
				.setTypeVerParamsAndReturnClass(MyPingJia, apiVer, params,
						type)
				.requestListener(
						new BaseSuccessReqListener<ShopPingJiabean>(
								getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

	@Override
	public void MyZengSongPingJia(String uid, String max_img, String page_no, String page_size) {
		// TODO Auto-generated method stub
		Type type = new TypeToken<MyZengSongPingJiaBean>() {
		}.getType();
		String apiVer = "100";
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("uid", uid);
		params.put("max_img", max_img);
		params.put("page_no", page_no);
		params.put("page_size", page_size);
		
		// 目前最简化调用
		// START
		(new Builder<MyZengSongPingJiaBean>())
				.setTypeVerParamsAndReturnClass(MyZengSongPingJia, apiVer, params,
						type)
				.requestListener(
						new BaseSuccessReqListener<MyZengSongPingJiaBean>(
								getListener()))
				.errorListener(new BaseErrorListener(getListener()))
				.desEncodeThenBuildAndSend();
	}

}
